package cuong.ptit.androidvn.helper;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

/**
 * 
 * @author LeCuong
 *This is a class to create methods to toast
 */

public class SmartToast {
	/**
	 * create a Long Toast
	 * @param context
	 * @param content
	 */
	public static void ToastLong(Context context, String message){
		Toast.makeText(context, message	, Toast.LENGTH_LONG).show();
	}
	
	/**
	 * Create a Short Toast
	 * @param context
	 * @param message
	 */
	public static void ToastShort(Context context,String message){
		Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
		
	}
	
	/**
	 * Creat a custom Toast
	 * @param context
	 * @param Id
	 * @param message
	 */
	
	public static void ToastCustom(Context context,int Id, String message){
		//context dang o trong activity moi dung dc,hoac service, ko dung dc o activity khac
		//Don't use text, view is layout
		Toast toast=new Toast(context);
		toast.setDuration(Toast.LENGTH_LONG);
		//phai ep kieu layout thanh view
		LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view=inflater.inflate(Id, null);
		toast.setView(view);
		toast.show();
	}

}
